import { Game } from "./Game";

export class Home {
    protected _view: fgui.GComponent;
    protected _game: Game;

    constructor() {
        let homeView = fgui.UIPackage.createObject("home", "Home").asCom;
        homeView.makeFullScreen();
        fgui.GRoot.inst.addChild(homeView);

        this._game = new Game(homeView.getChild('n6').asCom);
    }

    flushGame(){
        this._game.flush();
    }
}

let home:Home;

export function showHome(){
    if(!home){
        home = new Home();
    }
}

export function flushGame(){
    home.flushGame()
}